# 佶屈聱牙（jí qū áo yá）生成器
# 作者：意见
# 灵感来源：浙江一考生、浙江三教授、浙江卷、知乎众网友
# 感谢我一位不会python的朋友

import pandas as pd
import random

eter={i:0 for i in range(1,11)} # I see Eternal

art=[]
l1=[]  #to be or not to be
l2=[]
l3=[]
l4=[]
l5=[]
l6=[]
l7=[]
l8=[]
l9=[]
l10=[]
    
def ex_l(num):
    global l1 # Papa I don't want to do so
    global l3 # I will simplify it Yes I will
    global l4 # Why I cannot put exec and global together,kouheng
    global l5
    global l6
    global l7
    global l8
    global l9
    global l10

    if num==1:
        df=pd.read_excel("words.xls",usecols=[1,2],na_values='')
        l1=df.values.tolist()
        #if nan in l1:
         #   l1=l1[:l1.find(nan)]
    elif num==2:
        pass
    else:
        df=pd.read_excel("words.xls",usecols=[num],keep_default_na=False)
        if num==3: # It is not graceful at all
            o3=df.values.tolist()
            for i in o3:
                l3.append(i[0])
        elif num==4: # But I do not have other ways
            o4=df.values.tolist()
            for i in o4:
                l4.append(i[0])
        elif num==5:
            o5=df.values.tolist()
            for i in o5:
                l5.append(i[0])
        elif num==6:
            o6=df.values.tolist()
            for i in o6:
                l6.append(i[0])
        elif num==7:
            o7=df.values.tolist()
            for i in o7:
                l7.append(i[0])
        elif num==8:
            o8=df.values.tolist()
            for i in o8:
                l8.append(i[0])
        elif num==9:
            o9=df.values.tolist()
            for i in o9:
                l9.append(i[0])
        else:
            o10=df.values.tolist()
            for i in o10:
                l10.append(i[0])
        
for i in range(1,11):
    ex_l(i)

for i in range(1,11): # Great uncertainty
    if i!=1 and i!=2:
        exec('s%d=" ".join(l%d).strip()'%(i,i))
        exec('l%d=s%d.split(' ')'%(i,i))
    if i!=2:
        exec('random.shuffle(l%d)'%(i))


#data=pd.read_excel("words.xls")
f=open("empty.txt","r",encoding="utf-8")


tit=input('您的飒爽英姿与佶屈聱牙生成器相得益彰。\n请不吝赐教您煌煌巨著的点睛之笔：')
print('\n*****%s*****'%(tit))
for line in f.readlines():
    line=line.strip()
    if line.isdigit():
        if line==str(0):
            art.append(tit)
        elif line==str(1):
            art.append(l1[eter[1]][0])
            eter[1]+=1
        elif int(line) in range(3,10):
            exec('art.append(l'+str(line)+'[eter['+str(line)+']])')
            exec('eter['+str(line)+']+=1')
        else:
            art.append(l1[eter[1]][1])
    else:
        if line=='4(':
            line=l4[eter[4]]
        elif line=='6(':
            line=l6[eter[6]]
        elif line=='?':
            line='\n'
            
        art.append(line)
        

for i in range(len(art)):  # There must be an easier way
    if type(art[i])!=type('str'):   # But I do not know
        art[i]=str(art[i])
        
re=''.join(art)
print(re)


i=input('波谲云诡，逝者如斯。愿您珍惜体味这吉光片羽！')    
